# vim: syntax=perl:ts=4:sw=4
sub mm_form_groupaccess_to_portal_populate($) {
my $portal=$_[0];

	my $p2=hex_to_string($portal);
	#########################################################################
	# Firstly we define a table with the currently defined groups - if 	    #
	# any that are defined for this poprtal.
	#########################################################################
	my $egroups=$::GRI_FRONTEND->get_groups($p2);
	my $s="<input type=hidden name=portal value=\"$portal\"/>";
	if(defined($egroups) && @$egroups) {
		$s.="<tr class=gri_headerrow>
		<td class=gri_cell width=20%>Group Description</td>
		<td class=gri_cell-right width=10%>Access Allowed?</td>
	  </tr>";
		my $row=0;
		for $cg (@$egroups) {
			my $class="gri_odd";
			my $gh=substr($cg,2);
			my $d=hex_to_string($gh);
			$class="gri_even" if $row%2==0;
			$s.="<tr class=gri_row id=$class><td class=gri_cell>$d</td>";
			$s.="<td class=gri_cell-right width=10%><input type=checkbox name=\"RR_$gh\" value=1 checked=yes/></td>";
			$s.="</tr>\n";
			$row++;
		}
	} 
	return $s;
}
